<<usegrids>>
<table class="admingrid" id="invoices">
</table>
<div id="invoices_pager"></div>
<button onclick="invoicePayed()">Invoice payed</button>

<script>
grids.invoices = {
    url : generateServiceUrl({
        admin : true,
        service : "getinvoices",
        page : "invoices"
    }),
    colNames : [
        "Firstname",
        "Lastname",
        "Companyname",
        "Invoice no."
    ],
    colModel : [
        { name : "firstname",    index : "firstname",   width : 150 },
        { name : "lastname",     index : "lastname",   width : 150 },
        { name : "company_name", index : "company_name",   width : 200 },
        { name : "company_name", index : "company_name",   width : 80 }
    ],
    caption : "Invoice list"
};

createGrids();

function invoicePayed() {
    callAdminService("invoices", "invoicepayed", {
        id : getSelectedRow("invoices")
    }, {
        success : function(result) {
            displayMessage("info", "Invoice has been payed");
            refreshGrid("invoices");
        }
    });
}

</script>
